/**
 * 
 */
package com.sj.szxy.courseschedule.constrant;

import java.util.ArrayList;
import java.util.List;

import com.sj.szxy.courseschedule.entity.course.Course;

/**
 * @author Yi Ping
 * @date 2018年3月30日 下午4:18:43 
 * @since 1.0.0
 *
 */
public class CompoundConstraint extends Constraint{
	
	private List<Constraint> constraints = new ArrayList<>();

	@Override
	public boolean support(Course course) {
		boolean result = true;
		for (Constraint constraint : constraints) {
			result = result & constraint.support(course);
			if(!result)
				break;
		}
		
		return result;
	}
	
	public void add(Constraint constraint) {
		constraints.add(constraint);
	}
	
}
